package com.dylan.test;

import com.dylan.array.TwoSum;

/**
 * @author dylan1009
 */
public class ArrayTester {
    public static void main(String[] args) {
        int[] nums1 = {2, 7, 11, 15};
        int[] nums2 =new  int[]{2, 7, 11, 15};
        int[] nums3 =new  int[4];
        nums3[0] =2;
        nums3[1] =7;
        nums3[2] =11;
        nums3[3] =15;
        int target = 9;

        TwoSum tester = new TwoSum();
        int[] x1 = tester.twoSum1(nums1,target);
        System.out.print("暴力法-------");
        for (int i = 0; i < x1.length; i++) {
            System.out.print(x1[i]);
            System.out.print(":");
        }
        System.out.println("----------------  嘻嘻嘻 ");

        int[] x2 = tester.twoSum2(nums2,target);
        System.out.print("两遍哈希表--------");
        for (int i = 0; i < x2.length; i++) {
            System.out.print(x2[i]);
            System.out.print(":");
        }
        System.out.println("----------------   ");

        int[] x3 = tester.twoSum3(nums3,target);
        System.out.print("一遍哈希表-------");
        for (int i = 0; i < x3.length; i++) {
            System.out.print(x3[i]);
            System.out.print(":");
        }
        System.out.println("----------------   ");
    }
}
